#include "infolabel.h"

#include <QPalette>
#include <QHBoxLayout>

InfoLabel::InfoLabel( QWidget *aParent ) : QWidget( aParent )
{
    QHBoxLayout *mainLayout = new QHBoxLayout( this );
	pIcon = new QLabel( this );
	pText = new QLabel( this );
	pText->setTextFormat( Qt::RichText );
	mainLayout->addWidget( pIcon, 0 );
	mainLayout->addWidget( pText, 2 );
	mainLayout->setSpacing( 0 );

	QPalette pal = palette();
    pal.setColor( QPalette::Window, Qt::yellow );
    setPalette( pal );
	pIcon->setPalette( pal );
	pText->setPalette( pal );
}

InfoLabel::~InfoLabel()
{

}

void InfoLabel::setMessage( const QString &aText, const KIcon &aIcon )
{
	pIcon->setAutoFillBackground( true );
	pText->setAutoFillBackground( true );

	pIcon->setPixmap( aIcon.pixmap( 20, 20 ) );
	pText->setText( aText );
}

void InfoLabel::clear()
{
	pIcon->clear();
	pText->clear();

	pIcon->setAutoFillBackground( false );
	pText->setAutoFillBackground( false );
}
